package com.porterhead.account;

import com.porterhead.account.api.ApiAccount;
import com.porterhead.service.BaseService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Random;

import javax.validation.Validator;

@Service
public class AccountServiceImpl extends BaseService implements AccountService {

    private static final Random random = new Random();

    @Autowired
    public AccountServiceImpl(Validator validator) {
        super(validator);
    }

    @Override
    public ApiAccount getAccount(String userId, String accountId) {

        ApiAccount apiAccount = new ApiAccount();

        apiAccount.setId(accountId);
        apiAccount.setName("My Account");
        apiAccount.setBalance(random.nextInt(1000000));

        return apiAccount;
    }
}
